local skynet = require "skynet"

local service_helper = {}

function service_helper.send(name,...)
    return pcall(skynet.send,name,"lua",...)
end

function service_helper.call(name,...)
    return pcall(skynet.call,name,"lua",...)
end

service_helper.services = {
    agents = "AGENTS",
    math = "MATH",
    race = "RACE",
    watchdog = "WATCHDOG",
}

function service_helper.send2Agent(id,...)
    skynet.error("send2Agent id:" .. tostring(id))
    return service_helper.send(service_helper.services.agents,id,...)
end

function service_helper.send2Match(id,...)
    skynet.error("send2Match id:" .. tostring(id))
    return service_helper.send(service_helper.services.math,id,...)
end

function service_helper.send2Race(id,...)
    skynet.error("send2Race id:" .. tostring(id))
    return service_helper.send(service_helper.services.race,id,...)
end

return service_helper